package contegor.scire.structure.queries;

import contegor.scire.core.Concept;
import contegor.scire.core.Id;
import contegor.scire.core.Link;
import contegor.scire.core.Version;
import contegor.scire.core.queries.And;
import contegor.scire.core.queries.IsConnectedWith;
import contegor.scire.core.queries.Query;
import contegor.scire.core.queries.WithFlow;
import contegor.scire.structure.Constants;

/**
 * {@link Query} that fetches recursively instances of a {@link Concept} identified by its {@link Id}.
 *
 * @version $Revision$
 * @author  Héctor Cirbián Pousa ($Author$)
 */
@Version("$Id$")
public class GetInstancesOf extends BaseRecursiveQuery {
  private static final long serialVersionUID = -4385138940211787577L;

  @SuppressWarnings("unchecked")
  public GetInstancesOf(Id id) {
    super(id, 
          new And<Link>(new IsConnectedWith<Link>(Constants.ABSTRACT, WithFlow.DOWNSTREAM), new IsConnectedWith<Link>(Constants.TO_BE_SER, WithFlow.NONE)),
          new And<Link>(new IsConnectedWith<Link>(Constants.CONCRETE, WithFlow.DOWNSTREAM), new IsConnectedWith<Link>(Constants.TO_BE_SER, WithFlow.NONE)));
  }
}
